<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBlogsTable extends Migration
{


    /**
     * Run the migrations.
     *
     * @return void
     *
     * 创建数据迁移：(表名为复数)
     * 方法1:php artisan make:migration create_表名s_table
     * 方法2(在创建model时创建):php artisan make:model 模型名称 -m
     *
     * 执行命令创建数据表：php artisan migrate
     */
    public function up()
    {
        Schema::create('blogs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0);
            $table->string('title');
            $table->text('content');
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('blogs');
    }
}
